package com.project.fiveCerealsSavoury.domain;


import java.sql.Timestamp;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * 物流信息
 */
public class LogisticsDomain {
	/**
	 * 编号
	 */
	private Integer id;
	/**
	 * 公司名称
	 */
	@NotBlank(message="公司名字不能为空")
	@Length(min=2,max=5,message="名字长度必须在{min}~{max}")
	private  String name;
	/**
	 * 发送地址,也就是公司地址
	 */
	@NotNull(message="发送地址不能为空")
	private String  startAddress;
	/**
	 * 1.未派送2.派送中3.已送达
	 */
	@NotNull(message="不能为空")
	private LogitsticsState deliverGoods; 
	/**
	 * 送货时间
	 */
	@NotNull(message="不能为空")
	private Timestamp  deliveryTime;
	/**
	 * 送货人ID
	 */
	@NotNull(message="不能为空")
	private Integer deliveryId;
	/**
	 *运单号
	 */
	@NotNull(message="不能为空")
	private String waybillId;
	/**
	 * 订单id
	 */
	@NotNull(message="不能为空")
	private Integer indentId;
	/**
	 * 中途地址
	 */
	@NotNull(message="不能为空")
	private String midway;
	
	public String getMidway() {
		return midway;
	}

	public void setMidway(String midway) {
		this.midway = midway;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStartAddress() {
		return startAddress;
	}

	public void setStartAddress(String startAddress) {
		this.startAddress = startAddress;
	}

	public LogitsticsState getDeliverGoods() {
		return deliverGoods;
	}

	public void setDeliverGoods(LogitsticsState deliverGoods) {
		this.deliverGoods = deliverGoods;
	}

	public Timestamp getDeliveryTime() {
		return deliveryTime;
	}

	public void setDeliveryTime(Timestamp deliveryTime) {
		this.deliveryTime = deliveryTime;
	}

	public Integer getDeliveryId() {
		return deliveryId;
	}

	public void setDeliveryId(Integer deliveryId) {
		this.deliveryId = deliveryId;
	}

	public String getWaybillId() {
		return waybillId;
	}

	public void setWaybillId(String waybillId) {
		this.waybillId = waybillId;
	}

	public Integer getIndentId() {
		return indentId;
	}

	public void setIndentId(Integer indentId) {
		this.indentId = indentId;
	}

	
	
	public LogisticsDomain() {
		super();
	}

	@Override
	public String toString() {
		return "LogisticsDomain [id=" + id + ", name=" + name + ", startAddress=" + startAddress + ", deliverGoods="
				+ deliverGoods + ", deliveryTime=" + deliveryTime + ", deliveryId=" + deliveryId + ", waybillId="
				+ waybillId + ", indentId=" + indentId + ", midway=" + midway + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((deliverGoods == null) ? 0 : deliverGoods.hashCode());
		result = prime * result + ((deliveryId == null) ? 0 : deliveryId.hashCode());
		result = prime * result + ((deliveryTime == null) ? 0 : deliveryTime.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((indentId == null) ? 0 : indentId.hashCode());
		result = prime * result + ((midway == null) ? 0 : midway.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((startAddress == null) ? 0 : startAddress.hashCode());
		result = prime * result + ((waybillId == null) ? 0 : waybillId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		LogisticsDomain other = (LogisticsDomain) obj;
		if (deliverGoods != other.deliverGoods)
			return false;
		if (deliveryId == null) {
			if (other.deliveryId != null)
				return false;
		} else if (!deliveryId.equals(other.deliveryId))
			return false;
		if (deliveryTime == null) {
			if (other.deliveryTime != null)
				return false;
		} else if (!deliveryTime.equals(other.deliveryTime))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (indentId == null) {
			if (other.indentId != null)
				return false;
		} else if (!indentId.equals(other.indentId))
			return false;
		if (midway == null) {
			if (other.midway != null)
				return false;
		} else if (!midway.equals(other.midway))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (startAddress == null) {
			if (other.startAddress != null)
				return false;
		} else if (!startAddress.equals(other.startAddress))
			return false;
		if (waybillId == null) {
			if (other.waybillId != null)
				return false;
		} else if (!waybillId.equals(other.waybillId))
			return false;
		return true;
	}


}